package com.md.value.html;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @author 刘骄阳
 * 2024-06-18 11:45
 */
@AllArgsConstructor
@Getter
public enum ColorIndex {
  BLACK(0, "black", "#000000"),
  WHITE(1, "white", "#FFFFFF"),
  RED(2, "red", "#FF0000"),
  GREEN(3, "green", "#00FF00"),
  DARKBLUE(4, "darkBlue", "#00008B"),
  YELLOW(5, "yellow", "#FFFF00"),
  MAGENTA(6, "magenta", "#FF00FF"),
  DARKMAGENTA(7, "darkMagenta", "#8B008B"),
  DARKGRAY(8, "darkGray", "#A9A9A9"),
  LIGHTGRAY(9, "lightGray", "#DCDCDC"),
  DARKGREEN(10, "darkGreen", "#006400"),
  CYAN(11, "cyan", "#00FFFF"),
  DARKCYAN(12, "darkCyan", "#008B8B");
  static final Map<String, ColorIndex> ENUM_MAP_EN = Arrays.stream(ColorIndex.values())
    .collect(Collectors.toMap(ColorIndex::getEn, Function.identity()));
  private final Integer idx;
  private final String en;
  private final String hex;

  public static ColorIndex of(final String en) {
    return ENUM_MAP_EN.getOrDefault(en, WHITE);
  }


}
